<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title><!--排 班查询--></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="css/project/ui-res-v3.css">
    <link rel="stylesheet" href="css/project/ui-input-v3.css">
    <link rel="stylesheet" href="css/project/ui-color-v3.css">
	<link rel="stylesheet" href="css/project/style.css">
    <link rel="stylesheet" href="css/ui-base.css">
    <link rel="stylesheet" href="css/ui-box.css">
	<link rel="stylesheet" href="css/project/style.css">
	<link rel="stylesheet" href="css/zv_common.css">
    <script src="js/zy_control.js"></script>
	<script src="js/zy_click.js"></script>
	<script src="js/zy_json.js"></script>
	 <script src="js/zy_click.js"></script>
    <script src="js/main.js"></script>
	<script src="js/init.js"></script>
	<script src="js/talkingdata.js"></script>
</head>
<body class="um-vp " style="background:none" ontouchstart>
<div id="page_1" class="ub ub-ver um-vp">
<style type="text/css">
    #oContainer { 
        
    }
    .DateTable { 
         word-break: break-all;	
    }
	.datanum{ 
		position:absolute;
		background:red;
		padding:0.1em;
		width:1.3em;
		height:1.3em; overflow:hidden;
		line-height:1.3em;
		text-align:center;
		display:block;
		top:1px;
		right:1px;
		color:#ccc;
		font-size:0.6em;
		z-index:99999;
		-moz-border-radius: 100%;      /* Gecko browsers */
    	-webkit-border-radius: 100%;   /* Webkit browsers */
    	border-radius:100%;            /* W3C syntax */
	}
.datanum2{ 
		position:absolute;
		background:red;
		padding:0.1em;
		width:2em;
		height:1.3em; overflow:hidden;
		line-height:1.3em;
		text-align:center;
		display:block;
		top:1px;
		right:1px;
		color:#ccc;
		font-size:0.6em;
		z-index:99999;
    background: red;
    -moz-border-radius:2em /1.3em;
    -webkit-border-radius: 2em / 1.3em;
    border-radius: 2em / 1.3em;
	}
	
	
	
	.DateTable td{ height:3em; position:relative; width:10%}
    .WeekTd, .BlankTd { 
                  font: 10pt; 
                  border: 1px solid #a2c7df; 
    }
    .Today { 
                  font: 10pt; 
                  color: red; 
                  cursor: hand; 
                  position: relative;
    }
    .MonthTd { 
                  font: 10pt; 
                  font-family: webdings; 
                  cursor: hand; 
                  border: 1px solid #a2c7df; 
                  zmm: expression(onmouseenter = function() {
                                  style.color = 'red'; 
                       }, 
                       onmouseout = function() { 
                                  style.color = ''; 
                       }); 
    }
    .SelectTd { 
                  border: 1px solid #a2c7df; 
    }
    .over { 
                  position: relative; 
                  cursor: hand; 
                  border-right: 1px solid #a2c7df; 
                
    }
    .out { 
                  border: 1px solid #a2c7df;
    }
    .down { 

                   border: 1px solid #a2c7df;
				   background:#dff0fc
    }
</style>
<script language="javascript">
    var oDate = new Object();
    function DateClass(_container,array) {
        this.author = 'lizhongwen';
        this.version = 'Web Calendar 1.0';
        this.container = _container;
        this.weekArr = ['日', '一', '二', '三', '四', '五', '六'];
        this.dateArr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        this.showTable = function(_year, _month) {
             this.container.innerHTML = this.getDateTable(_year, _month);
        }
		var SiteName = localStorage.getItem("SiteName");
		if(SiteName!='')
		{
			if(SiteName=='PVGPAX')
			{
				SiteName='浦东旅服';
			}
			else if(SiteName=='PVGWB')
			{
				SiteName='浦东载重';
			}	
			else if(SiteName=='SHALUG')
			{
				SiteName='虹桥行李';
			}	
			else if(SiteName=='PVGHCC')
			{
				SiteName='浦东HCC';
			}	
			else if(SiteName=='PVGLOAD')
			{
				SiteName='浦东装卸';
			}
			else if(SiteName=='PVGLUG')
			{
				SiteName='浦东行李';
			}	
			else if(SiteName=='PVGRAMP')
			{
				SiteName='浦东站坪';
			}		
			else if(SiteName=='SHAACC')
			{
				SiteName='虹桥ACC';
			}		
			else if(SiteName=='SHALOAD')
			{
				SiteName='虹桥装卸';
			}		
			else if(SiteName=='SHAPAX')
			{
				SiteName='虹桥旅服';
			}	
			else if(SiteName=='SHARAMP')
			{
				SiteName='虹桥站坪';
			}	
			else if(SiteName=='SHAWB')
			{
				SiteName='虹桥载重';
			}	
			else{
				SiteName='地服领域';
			}
		}
        this.getDateTable = function(_year, _month) {
             if (this.checkArgs(_year, _month)) {
                 _year = parseInt(this.checkDate(_year, _month).split('-')[0]);
                 _month = parseInt(this.checkDate(_year, _month).split('-')[1]);
                 this.Thead = '<table cellpadding="0" cellspacing="5" width="100%" class="DateTable">\n';
                 this.Thead += '<tr><td align="center" class="MonthTd" onclick="setP(' + _year + ', ' + eval(_month-1) + ');"><img src="images/larrow.png"  width="25%"></td>';
                 this.Thead += '<td align="center" colspan="5" class="SelectTd">'+SiteName+' 【<span id="mons">'+_month+'</span>月】<select onchange="oDate.showTable(options[selectedIndex].value, ' + _month + ');" style="display:none">';
                 for (var i=2000; i<2015; i++) this.Thead += '<option value="' + i + '" ' + ((_year==i) ? 'selected' : '') + '>' + i + '年</option>';
                 this.Thead += '</select><select style="display:none" onchange="oDate.showTable(' + _year + ', options[selectedIndex].value);">';
                 for (var i=1; i<13; i++) this.Thead += '<option value="' + i + '" ' + ((_month==i) ? 'selected' : '') + '>' + i + '月</option>';
                 this.Thead += '</select></td>';
                 this.Thead += '<td align="center" class="MonthTd" onclick="setN(' + _year + ', ' + eval(_month+1) + ');"><img src="images/rarrow.png" width="25%"></td></tr>\n';
                 this.Thead += '<tr>';
                 for (var i=0; i<this.weekArr.length; i++) this.Thead += '<td align="center" class="WeekTd">' + this.weekArr[i] + '</td>';
                 this.Thead += '</tr>\n';
                 this.Tbody = '<tr>';
                 this.dateArr[1] = (!this.checkYear(_year)) ? 28 : 29 ;
                 for (var i=0; i<this.firstPos(_year, _month); i++) this.Tbody += '<td class="BlankTd"></td>';
                 for (var i=1; i<=this.dateArr[_month-1]; i++) {
                      if (this.firstPos(_year, _month) == 0) {
                          if (i!=1 && i%7==1) this.Tbody += '</tr>\n<tr>';
                      } else {
                          if ((i+this.firstPos(_year, _month))%7==1) this.Tbody += '</tr>\n<tr>';
                      }
                      if (!this.today(_year, _month, i)) {
					  	  if (array[i]!='')
						  {
						  	this.Tbody += '<td align="center" class="out" onmouseover="className=\'over\';" onmouseout="className=\'out\';" onmousedown="className=\'down\';" onclick="LoadDataS('+_year+','+_month+','+i+',1)">' + i + " " + array[i] + '</td>';
						  }
						  else
						  {
						  	this.Tbody += '<td align="center" class="out" >' + i + " " + array[i] + '</td>';
						  }
						  
                      } else {
                         this.Tbody += '<td align="center" class="Today" onclick="LoadDataS('+_year+','+_month+','+i+',1)">' + i + " " + array[i] + '</td>'; 
                      } 
                 }
                 for (var i=0; i<6-this.lastPos(_year, _month); i++) this.Tbody += '<td class="BlankTd"></td>';
                 this.Tbody += '</tr>\n'; 
                 this.TFoot = '</table>\n';
                 this.Table = this.Thead + this.Tbody + this.TFoot;
                 return this.Table;
             } else {
                 return 'Arguments Error!';
             }            
         }

         this.firstPos = function(_year, _month) {
              return new Date(_year, _month-1, 1).getDay();
         }

         this.lastPos = function(_year, _month) {
              return new Date(_year, _month-1, this.dateArr[_month-1]).getDay();
         }

         this.checkYear = function(_year) {
              return ((_year % 4 == 0) && (_year % 100 != 0)) || (_year % 400 == 0);
         }

         this.today = function(_year, _month, _date) {
              return (new Date().getFullYear() == _year) && (new Date().getMonth() == _month-1) && (new Date().getDate() == _date);
         }
 
         this.checkArgs = function(_year, _month) {
              if (_year<1900 || _year>2100) return false;
              if (_month<0 || _month>13) return false;
              return (!isNaN(_year) && !isNaN(_month));           
         }
         this.checkDate = function(_year, _month) {
              if (_month<1) { 
                  _year --;
                  _month = 12;
              }
              if (_month>12) { 
                  _year ++;
                  _month = 1;
              }
              return _year + '-' + _month;
         } 
        
         this.showDateStr = function(_year, _month, _date, _week) {
              window.alert(_year + '年' + _month + '月' + _date + '日 星期' + _week);  
         }
    }
  	var PeriodStart = localStorage.getItem("PeriodStart");//开始时间
	if(PeriodStart!='')
	{
		strs=PeriodStart.split("-"); //字符分割 
		PeriodStart_year=strs[0]
		PeriodStart_month=strs[1]
		PeriodStart_date=strs[2]
		//PeriodStart = PeriodStart.substring(0,5);//截取
	}
	var PeriodEnd = localStorage.getItem("PeriodEnd");//结束时间
	if(PeriodEnd!='')
	{
		
		strs=PeriodEnd.split("-"); //字符分割 
		PeriodEnd_year=strs[0]
		PeriodEnd_month=strs[1]
		PeriodEnd_date=strs[2]
	}
    window.onload = function() {
		getData(PeriodStart_year,PeriodStart_month);
    }
	function getData(y,m)
	{
		
	
		var array = new Array();
		if(m=="13")
		{
			m='1';
		}
		if(m=="0")
		{
			m='12';
		}
		if(m<10)
		{
			//m='0'+m
		}
		currenttime=y+''+m//当前年月
		currenttime2=y+'-'+m//当前年月
		PeriodStarttime=PeriodStart_year+''+PeriodStart_month//起始年月
		PeriodEndtime=PeriodEnd_year+''+PeriodEnd_month//结束年月
		var json = localStorage.getItem("zvData");
		var jsona ='['+json+']';
		var  obj = strToJson(jsona);
		var objdata = obj[0].DataTable;
		var enl=objdata.length
		if(enl==undefined || enl=="undefined")
		{
			var stringObj=json
			var zv_newstr=stringObj.replace('{"DataTable":{"Rows":{','[{"DataTable":[{'); //字符替换 
			zv_newstr=zv_newstr.replace('}}}','}]}]'); //字符替换 
			zv_objdata = strToJson(zv_newstr);
			objdata = zv_objdata[0].DataTable;
		}
		if(PeriodStarttime==PeriodEndtime)
		{
				
			for(var i=1;i<=31;i++)
			{
				if(i>=PeriodStart_date && i<=PeriodEnd_date)
				{  
					var Every_day=i
					if(Every_day<10)
					{
						//Every_day='0'+Every_day
					} 
					current_date=currenttime2+'-'+Every_day
					var zv_number='0'
					for (var a = 0; a < objdata.length; a++) {
						
						var Cts = "a" + objdata[a].dateId;
						if(Cts.indexOf(current_date)>0)
						{
							zv_number=objdata[a].OndutyNumber
						}
					}
					if(zv_number<1)
					{
						array[i] = "";
					}
					else if(zv_number>99)
					{
						array[i] = "<div class='datanum2'>99+</div>";
					}
					else
					{
						array[i] = "<div class='datanum'>"+zv_number+"</div>";
					}
				}
				else
				{
					array[i] = "";
				}
			}
		}
		
		else if(PeriodEndtime>PeriodStarttime )
		{   
			if(currenttime==PeriodStarttime)
			{
				for(var i=1;i<=31;i++)
				{
					if(i>=PeriodStart_date)
					{
						var Every_day=i
						if(Every_day<10)
						{
							//Every_day='0'+Every_day
						} 
						current_date=currenttime2+'-'+Every_day
						var zv_number='0'
						for (var a = 0; a < objdata.length; a++) {
							var Cts = "a" + objdata[a].dateId;
							if(Cts.indexOf(current_date)>0)
							{
								zv_number=objdata[a].OndutyNumber
							}
						}
						
						if(zv_number<1)
						{
							array[i] = "";
						}
						else if(zv_number>99)
						{
							array[i] = "<div class='datanum2'>99+</div>";
						}
						else
						{
							array[i] = "<div class='datanum'>"+zv_number+"</div>";
						}
					}
					else
					{
						array[i] = "";
					}
				}
			}
			else if(currenttime==PeriodEndtime)
			{
				for(var i=1;i<=31;i++)
				{
					if(i<=PeriodEnd_date)
					{
						var Every_day=i
						if(Every_day<10)
						{
							//Every_day='0'+Every_day
						} 
						current_date=currenttime2+'-'+Every_day
						var zv_number='0'
						for (var a = 0; a < objdata.length; a++) {
							var Cts = "a" + objdata[a].dateId;
							if(Cts.indexOf(current_date)>0)
							{
								zv_number=objdata[a].OndutyNumber
							}
						}
						if(zv_number<1)
						{
							array[i] = "";
						}
						else if(zv_number>99)
						{
							array[i] = "<div class='datanum2'>99+</div>";
						}
						else
						{
							array[i] = "<div class='datanum'>"+zv_number+"</div>";
						}
					}
					else
					{
						array[i] = "";
					}
				}
			}
			
			else
			{
				for(var i=1;i<=31;i++)
				{
						var Every_day=i
						if(Every_day<10)
						{
							//Every_day='0'+Every_day
						} 
						current_date=currenttime2+'-'+Every_day
						var zv_number='0'
						for (var a = 0; a < objdata.length; a++) {
							var Cts = "a" + objdata[a].dateId;
							if(Cts.indexOf(current_date)>0)
							{
								zv_number=objdata[a].OndutyNumber
							}
						}
						if(zv_number<1)
						{
							array[i] = "";
						}
						else if(zv_number>99)
						{
							array[i] = "<div class='datanum2'>99+</div>";
						}
						else
						{
							array[i] = "<div class='datanum'>"+zv_number+"</div>";
						}
				}	
			}
			
		}
         oDate = new DateClass(self.oContainer,array);
         oDate.showTable(y,m);
	}
	function setP(_year,_month)
   {
		if(_month=='0')
		{
			_month=12
			_year=_year-1
		}
		if(_year>PeriodStart_year)
		{
			getData(_year,_month);
			oDate.showTable(_year, parseInt(_month));	
		}
		if(_year==PeriodStart_year)
		{
			if(_month>=PeriodStart_month)
			{	
				getData(_year,_month);
				oDate.showTable(_year, parseInt(_month));	
			}
		}
   }
   
   function setN(_year,_month)
   {
		if(_month=='13')
		{
			_month=1
			_year=_year+1
		}
 		if(_year<PeriodEnd_year)
		{
			
			getData(_year,_month);
			oDate.showTable(_year, parseInt(_month));	
		}
		if(_year==PeriodEnd_year)
		{
			if(_month<=PeriodEnd_month)
			{	
				getData(_year,_month);
				oDate.showTable(_year, parseInt(_month));	
			}
		}
   }
</script>
<div id="oContainer"></div>
</div>
	<div ontouchstart="zy_touch('zv-btn-act')" class="zvbtn  c-blu1  t-wh tx-c uc-a1 zvbtnpadding" style="text-align:center;"     onclick="LoadDataS2(1)" >查看详情</div>
</body>
<script>
zy_init();
window.uexOnload=function(type){
	if(!type){
		uexWindow.setBounce("0");
		IC.talkingDataCount("排班查询","0007");
	}
	var w = $$("page_1").offsetWidth;
}

function LoadDataS(zv_year,zv_month,zv_day,page){
	IC.talkingDataCount("排班查询","0007");
		if(zv_month<10)
		{
			zv_month='0'+zv_month
		} 
		if(zv_day<10)
		{
			zv_day='0'+zv_day
		} 
		var zv_current=zv_year+'-'+zv_month+'-'+zv_day//当前时间
			//checkUserRole(ZV_EMPLOYEE_NUMBER,'BTN_3_19',function(){LoadDataSall(zv_current,page);});
		LoadDataSall(zv_current,page)
}
function LoadDataSall(zv_current,page){
	IC.talkingDataCount("排班查询","0007");
	Loading(0);
	localStorage.setItem("scheduling_searchresult_page",page);
	localStorage.setItem("zv_current",zv_current);
	var SiteName=localStorage.getItem("SiteName");//站点名称
	var SiteID=localStorage.getItem("SiteID");//SiteID
	var EmployeeNumber=localStorage.getItem("EmployeeNumber");//员工工号
	
	var wsdl = scheduling_list_url
    var nameSpace = scheduling_list_nameSpace
	var paras = "CenterName|SiteID|PeriodStart|EmployeeNumber|PeriodEnd|PageCount|CurrentPage";
	var values = SiteName+'|'+SiteID+'|'+zv_current+'|'+EmployeeNumber+'|'+zv_current+'|20|'+page;
	var method = scheduling_list_function
	if(page>=2)
	{
		setLocalJosnPage(wsdl,nameSpace,paras,values,method,"scheduling_searchresult","scheduling_list");		
	}
	else
	{
		setLocalJosn(wsdl,nameSpace,paras,values,method,"scheduling_searchresult","scheduling_searchresult.html");	
	}
}
function LoadDataS2(page){
			IC.talkingDataCount("排班查询","0007");
			uexEMM.setEvent("1","{'排班查询':'查看详情'}");
			//checkUserRole(ZV_EMPLOYEE_NUMBER,'BTN_3_19',function(){LoadDataS2all();});
			LoadDataS2all(page)
}
function LoadDataS2all(page){
	Loading(0);
	localStorage.setItem("zv_current",'');
	localStorage.setItem("scheduling_searchresult_page",page);
	var SiteName=localStorage.getItem("SiteName");//站点名称
	var SiteID=localStorage.getItem("SiteID");//SiteID
	var EmployeeNumber=localStorage.getItem("EmployeeNumber");//员工工号
	var PeriodStart=	localStorage.getItem("PeriodStart");//开始日期
	var PeriodEnd=localStorage.getItem("PeriodEnd");//结束日期
	var wsdl = scheduling_list_url
    var nameSpace = scheduling_list_nameSpace
	var paras = "CenterName|SiteID|PeriodStart|EmployeeNumber|PeriodEnd|PageCount|CurrentPage";
	var values = SiteName+'|'+SiteID+'|'+PeriodStart+'|'+EmployeeNumber+'|'+PeriodEnd+'|20|'+page;
	var method = scheduling_list_function
	if(page>=2)
	{
		setLocalJosnPage(wsdl,nameSpace,paras,values,method,"scheduling_searchresult","scheduling_list");		
	}
	else
	{
		setLocalJosn(wsdl,nameSpace,paras,values,method,"scheduling_searchresult","scheduling_searchresult.html");	
	}
	//openNewWin('scheduling_searchresult','scheduling_searchresult.html');
}
</script>
</html>
